<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>管理系统</title>
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
  <?php if($form_parm_arr['static_html']){ ?>
    {$form_parm_arr['static_html']|raw}
  <?php }else{ ?>
    {:widget_st('layui','css')}
    {:widget_st('jq','js')}
    {:widget_st('layui','js')}  
    {:widget_st('admin','css')}
    {:widget_st('laydate','js')}
    {:widget_st('webuploader')}
    {:widget_st('common','js')}
    {:widget_st('ueditor')}       
    {:widget_st('input-select')}    
  <?php } ?> 
       
</head>
{:do_action('admin_head')}
<style>
  html{background-color: #fff;}
  .layui-card {box-shadow:0 0 0 0;}
  .layui-card-header{border-bottom: 0;}
  .layui-row{padding-top: 0;}
  .layui-fluid{padding-top:0;}
  .layui-tab{margin:0;}
</style>
<body>
  <div class="layui-fluid">
    <div class="layui-row layui-col-space15">
      <?php $form_widget = new \app\common\widget\FormPro();  ?>
      <form method="post" class="info_tj" >
        <input type="hidden" name="cid" value="{$res.cid}">
        <input type="hidden" name="t" value="{$t}">
        <div class="layui-tab layui-tab-brief">
          <ul class="layui-tab-title">
            <li class="layui-this">基本设置</li>
            <li>扩展参数</li>
          </ul>
          <div class="layui-tab-content">
            <div class="layui-tab-item layui-show">
              <div class="layui-col-sm12">
                <div class="layui-row layui-col-space15">
                  <?php if($form_parm_arr['form_parm'] && isset($form_parm_arr['form_parm']['ini']) && $form_parm_arr['form_parm']['ini']['zf_form_status']==1 ){ ?>
                    {include file="public/tpl_diy_url"}

                    {include file="public/form_parm_show"}
                    {include file="public/widget_submit"}

                  <?php }else{ ?>
                    <!-- 默认表单 -->
                    <div class="layui-col-sm9">
                      <div class="layui-card">

                        {:do_action('add_category_edit_l_view',$res,$form_widget,$hook_data)}

                      </div>
                    </div>
                    <div class="layui-col-sm3">
                      <div class="layui-card">
                        {:do_action('add_category_edit_rt_view',$res,$form_widget,$hook_data)}
                        {$form_widget->upload_pic(['title'=>'封面图','name'=>'pic','data'=>$res['pic'],'notes'=>'','theme'=>1])|raw}
                        {$form_widget->form_time(['title'=>'时间','name'=>'ctime','data'=>date("Y-m-d H:i:s",$res['ctime']),'notes'=>'','theme'=>1,'time_type'=>'datetime'])|raw}
                        {$form_widget->form_input(['title'=>'排序','name'=>'sort','data'=>$res['sort'],'notes'=>'','theme'=>1])|raw}
                        {$form_widget->form_select(['title'=>'父类','name'=>'pid','data'=>$res['pid'],'id_t'=>'cid', 'name_t'=>'name','list_arr'=>$plist,'notes'=>'','theme'=>1])|raw}
                        {$form_widget->form_select(['title'=>'栏目模型','name'=>'mid','data'=>$res['mid'],'id_t'=>'id', 'name_t'=>'name','list_arr'=>$mlist,'notes'=>'','theme'=>3])|raw}
                        {:do_action('add_category_edit_rb_view',$res,$form_widget,$hook_data)}
                      </div>
                      
                      {include file="public/widget_submit"}

                    </div>
                  <?php } ?>
                </div>
              </div>
            </div>
            <div class="layui-tab-item">
              {include file="public/tpl_field_append"}
            </div>
          </div>
        </div>
      </form>
        
      </div>
    </div>
  </div>
  


  <script>

 layui.use(['form','upload'], function(){
    var $ = layui.$
    ,admin = layui.admin
    ,element = layui.element
    ,form = layui.form
    ,upload = layui.upload;


      $('.tijiao').on("click",function(){
          var index = layer.load(2);
          var data = $(".info_tj input,.info_tj select,.info_tj textarea,.info_tj radio").serialize();      
          $.ajax({
              type:'post',
              url:"{:url('category/category_edit')}",
              data:data,
              dataType:'json',
              success:function(res){
                if(res.result==1){
                  layer.msg(res.msg, {icon: 1});
                  setTimeout(function() {
                      if(res.msg.code==1){
                        window.location.reload();
                      }else{
                        window.parent.location.reload();
                      }
                  }, 2000);
                }else{
                  layer.close(index);
                  layer.msg(res.msg, {icon: 2});
                }   
              }
          })
      })


  });
  function deleteFile(obj) {
   $(obj).parent().remove();
  }
  </script>
</body>
</html>
{:do_action('admin_js')}

